package ext.trace.geom;

import ext.trace.scene.Hit;
import math.math;
import math.rand.RNG;
import math.vec2;
import math.vec3;

public class LambertBRDF extends BRDF
{
    
    
    public LambertBRDF()
    {
        super();
    }
    
    
    public BRDF copy()
    {
        LambertBRDF copy = new LambertBRDF();
        copy.rAlbedo = this.rAlbedo;
        return copy;
    }
    
    
    public vec3 sample(
        Hit aHit, 
        vec3 aIncoming, 
        vec3 aOutgoing)
    {
        vec3 albedo = aHit.rColor.copy();
        albedo.div(math.PI);
        return albedo;
    }
    
    public vec3 randOutgoing(
        RNG aRNG, 
        vec3 aNormal)
    {
        return aRNG.unitHemisphere(aNormal);
    }
    
    public double probOfRandOutgoing(
        vec3 aNormal, 
        vec3 aRandOutgoing)
    {
        return 1.0 / (2.0 * math.PI);
    }
    
}
